package com.cavy.platform.server.dto;


import com.cavy.platform.server.domain.PluginEnvironment;
import com.cavy.platform.server.domain.PluginVolume;
import com.cavy.platform.server.validator.FormatValidatorGroup;
import com.cavy.platform.server.validator.LastValidatorGroup;
import com.cavy.platform.server.validator.NotRepeatPluginName;
import lombok.Data;

import javax.validation.GroupSequence;
import javax.validation.constraints.NotNull;
import java.util.HashSet;
import java.util.Set;

@Data
@NotRepeatPluginName(groups = LastValidatorGroup.class)
@GroupSequence({FormatValidatorGroup.class, LastValidatorGroup.class, PluginCreateDto.class})
public class PluginCreateDto {
    //名称
    @NotNull(message = "插件名称不能为空", groups = FormatValidatorGroup.class)
    private String name;
    //插件版本
    @NotNull(message = "插件版本不能为空", groups = FormatValidatorGroup.class)
    private String version;
    //描述
    @NotNull(message = "插件描述不能为空", groups = FormatValidatorGroup.class)
    private String description;
    //镜像
    @NotNull(message = "镜像不能为空", groups = FormatValidatorGroup.class)
    private String image;
    //命令
    private String command;
    //运行插件的user
    private String user;
    //挂载的卷
    // container_path,host_path,tips
    private Set<PluginVolume> volumes = new HashSet<>();
    //环境变量
    // name,value,tips
    private Set<PluginEnvironment> environments = new HashSet<>();
    //工作目录
    private String workDir;
}
